import { NativeModules } from 'react-native';
import { isIOS } from '../../constant';

const hideNativeKeyboard = (tag: number): void => {
  if (isIOS) {
    NativeModules.CustomKeyboard.hideNativeKeyboard(tag);
  }
};

const insertText = (tag: number, text: string): void => {
  NativeModules.CustomKeyboard.insertText(tag, text);
};

const doDelete = (tag: number): void => {
  NativeModules.CustomKeyboard.doDelete(tag);
};

const backSpace = (tag: number): void => {
  NativeModules.CustomKeyboard.backSpace(tag);
};

const deleteAll = (tag: number): void => {
  NativeModules.CustomKeyboard.deleteAll(tag);
};

export default {
  hideNativeKeyboard,
  insertText,
  doDelete,
  backSpace,
  deleteAll
};
